﻿Imports System.Data.SqlClient
Module Module1
    Public cn As SqlConnection
    Public str As String = "server=.;database=stock;UID=sa;PWD=123"
    Public Sub condb()
        Try
            cn = New SqlConnection(str)
            cn.Open()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub
    Public Sub Formatdatagrid(ByVal dtv As DataGridView)
        dtv.AllowUserToAddRows = False
        dtv.AllowUserToDeleteRows = False
        dtv.AllowUserToResizeColumns = False
        dtv.AllowUserToResizeRows = False
        dtv.AlternatingRowsDefaultCellStyle.BackColor = Color.Cyan
        dtv.Cursor = Cursors.Hand
        dtv.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None
        dtv.ColumnHeadersDefaultCellStyle.BackColor = Color.Transparent


    End Sub
End Module
